package cn.hefan.dao;

import java.sql.SQLException;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import cn.hefan.domain.Cominf;
import cn.hefan.util.DataSourceUtils;

public class CominfDao {

	public static Cominf Select() throws SQLException {
		QueryRunner qr = new QueryRunner(DataSourceUtils.getDataSource());
		String sql = "select * from corpn";
		return qr.query(sql, new BeanHandler<Cominf>(Cominf.class));
	}

	public static int updet(Cominf com) throws SQLException {
		QueryRunner qr = new QueryRunner(DataSourceUtils.getDataSource());
		String sql = "update corpn set name=?,intro=?,phone=?,img=? ";
		return qr.update(sql,com.getName(),com.getIntro(),com.getPhone(),com.getImg());
	}

}
